import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:xiongan_app_yy/provider/warehouse_info.dart';
import 'package:xiongan_app_yy/utils/device_utils.dart';
import 'package:xiongan_app_yy/widgets/comm/horizontal_list_commonly_widget.dart';
import 'package:xiongan_app_yy/widgets/comm/horizontal_list_home_widget.dart';

//仓内作业首页第一个页面
class WorkbenchPage extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    return WorkbenchPageState();
  }
}

class WorkbenchPageState extends State<WorkbenchPage> {
  /* List backgroundList = [ "assets/images/red_card_background.png", "assets/images/bule_card_background.png","assets/images/yellow_card_background.png"];
  List imageList = [ "assets/images/appointment.png", "assets/images/task.png","assets/images/info.png"];
  List titleList = [ "预约", "作业","信息"];
  List routeList = [ "/subscribeList", "/taskList","/infoList"];*/
  List imageList = [
    "assets/images/appointment.png",
    "assets/images/task.png",
    "assets/images/info.png"
  ];
  List titleList = ["任务待办", "作业", "信息"];
  List routeList = ["/tabPage", "/taskList", "/infoList"];

  List<String> commonlyImageList = [
    "assets/images/function01.png",
    "assets/images/function02.png",
    "assets/images/function03.png",
    "assets/images/function04.png"
  ];
  List<String> commonlyTextList = ["入库作业","出库作业", "移库作业", "盘库作业",];
  List<String> commonlyRouteList = [ "/into_warehousing", "/out_warehousing", "/move_library", "/inventoryopr",];
  List<String> informationImageList = [
    "assets/images/info01.png",
    "assets/images/info02.png",
    "assets/images/info03.png",
    "assets/images/info04.png"
  ];
  List<String> informationTextList = ["入库任务", "出库任务","非预约审核", "入库退货" ];
  List<String> informationRouteList = [  "/in_task", "/out_task", "/norderAuditResult","/warehousing_returns",];

  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Column(
        children: <Widget>[
          Container(
            height: 205,
            width: double.infinity,
            child: Stack(
              children: <Widget>[
                Image.asset(
                  "assets/images/real_background.png",
                  fit: BoxFit.fill,
                  width: double.infinity,
                ),
                Column(
                  children: <Widget>[
                    Container(
                      margin: EdgeInsets.only(top: 32, left: 15, right: 7),
                      child: Row(
                        children: <Widget>[
                          GestureDetector(
                            child: Container(
                                height: 23,
                                padding: EdgeInsets.only(left: 6),
                                decoration: BoxDecoration(
                                    color: Colors.white,
                                    borderRadius:
                                        BorderRadius.all(Radius.circular(10.0)),
                                    border: Border.all(
                                        width: 1,
                                        color: Colors.white) //设置所有的边框宽度为1 颜色为浅灰
                                    ),
                                child: Row(
                                  children: <Widget>[
                                    Text(
                                        Provider.of<WarehouseInfo>(context)
                                            .mode
                                            .text,
                                        style: TextStyle(fontSize: 13)),
                                    IconTheme(
                                      data: IconThemeData(),
                                      child: Icon(Icons.arrow_drop_down),
                                    ),
                                  ],
                                )),
                            onTap: () {
                              Navigator.pushNamed(
                                      context, "/warehouseSelection")
                                  .then((value) {});
                            },
                          ),
                          Expanded(
                            flex: 1,
                            child: Text(""),
                          ),
                          Row(
                            children: <Widget>[
                              Container(
                                  width: 28,
                                  height: 26,
                                  child: Image.asset("assets/images/cloudy.png",
                                      fit: BoxFit.fill)),
                              Text("0°",
                                  style: TextStyle(
                                      color: Colors.white, fontSize: 30)),
                              Column(
                                children: <Widget>[
                                  Text("雄安新区",
                                      style: TextStyle(
                                          fontSize: 10, color: Colors.white)),
                                  Text(
                                      "${DateTime.now().month}月${DateTime.now().day}日",
                                      style: TextStyle(
                                          fontSize: 10, color: Colors.white)),
                                ],
                              )
                            ],
                          )
                        ],
                      ),
                    ),
                    Expanded(
                        child: Column(
                      children: <Widget>[
                        Text("储检配一体化管理平台",
                            style: TextStyle(fontSize: 23, color: Colors.white))
                      ],
                      mainAxisAlignment: MainAxisAlignment.center,
                    ))
                  ],
                )
              ],
            ),
          ),
          Container(
              width: double.infinity,
              height: 120,
              color: Colors.white,
              child: Row(
                children: <Widget>[
                  Expanded(
                      child: HorizontalListHomeWidget(
                        badgeText: "0",
                          modular: "主菜单",
                          title: titleList[0],
                          image: imageList[0],
                          route: routeList[0],
                          margin: EdgeInsets.only(right: 0.5),
                          background: Color(0xff00A5F1))),
                  Expanded(
                      child: HorizontalListHomeWidget(
                          modular: "主菜单",
                          title: titleList[1],
                          image: imageList[1],
                          route: routeList[1],
                          margin: EdgeInsets.only(right: 0.5),
                          background: Color(0xff00A5F1))),
                  Expanded(
                      child: HorizontalListHomeWidget(
                          modular: "主菜单",
                          title: titleList[2],
                          image: imageList[2],
                          route: routeList[2],
                          background: Color(0xff00A5F1))),
                ],
              )),
    Expanded(child:  Scrollbar(
        child: SingleChildScrollView(child: Column(children: <Widget>[
          HorizontalListCommonlyWidget(height: 150,title: "常用作业功能",image: commonlyImageList,text: commonlyTextList,route:commonlyRouteList),
          HorizontalListCommonlyWidget(height: 150,title: "常用信息功能",image: informationImageList,text: informationTextList,route:informationRouteList),
        ],))),)


        ],
      ),
    );
  }
}
